﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BatchContract.aspx.cs" Inherits="H2.NET.Web.Pages.SMD.BatchContract" %>

<%@ Register Src="../../Controls/DwzAssessment.ascx" TagName="DwzAssessment" TagPrefix="uc" %>
<%@ Register Src="../../Controls/DwzAssessmentList.ascx" TagName="DwzAssessmentList" TagPrefix="uc" %>
<%@ Register Src="../../Controls/AjaxUpload.ascx" TagName="ajaxUpload" TagPrefix="uc" %>
<%@ Register Src="uc_change_field.ascx" TagName="uc_change_field" TagPrefix="uc" %>
<%@ Register Src="uc_head.ascx" TagName="uc_head" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE9" />
<head id="Head1" runat="server">
    <title>批量变更合同数据</title>
    <link href="<%=Page.ResolveUrl("~/Resource/Css/Style.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/jBox/Blue/jbox.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/LigerUI/skins/Aqua/css/ligerui-all.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/LigerUI/skins/Gray2014/css/all.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/LigerUI/LigeruiExtend.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Page.ResolveUrl("~/Resource/qtip/jquery.qtip.min.css")%>" rel="stylesheet" type="text/css" />
    <script src="<%=Page.ResolveUrl("~/Resource/dwz/js/jquery-1.7.2.min.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/Js/Common.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/jBox/jquery.jBox-2.3.min.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/jBox/jquery.jBox-zh-CN.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/LigerUI/js/ligerui.all.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/qtip/jquery.qtip.min.js")%>" type="text/javascript"></script>
    <script src="<%=Page.ResolveUrl("~/Resource/My97DatePicker/WdatePicker.js")%>" type="text/javascript"></script>
    <!--[if lt IE 8 ]><script src="<%=Page.ResolveUrl("~/Resource/Js/json2.min.js")%>" type="text/javascript"></script><![endif]-->
    <style type="text/css">
        #dialog-form {
            font-size: 62.5%;
        }

            #dialog-form label {
                width: 150px;
                display: inline-block;
                font-weight: 700;
                text-align: right;
            }

            #dialog-form input.text {
                margin-bottom: 12px;
                width: 180px;
                padding: .4em;
            }

            #dialog-form fieldset {
                padding: 0;
                border: 0;
                margin-top: 15px;
            }

                #dialog-form fieldset ul li {
                    display: inline-block;
                    width: 350px;
                    float: left;
                    height: 40px;
                    line-height: 40px;
                }

        .formTable input {
            padding: 2px;
        }

        .seachStore {
            display: inline-block;
            margin-top: 10px;
            height: 25px;
            line-height: 25px;
        }

        .l-grid-row-cell-inner .updated {
            display: inline-block;
            color: #ff0000;
            width: 100%;
        }
    </style>
    <script type="text/javascript">
        var update_logs = <%=update_logs%>;
        var storegrid;
        var isDblClickRow = true;
        $(function () {
            storegrid = $("#storegrid").ligerGrid({
                columns: [{
                    display: '操作', id: 'remove', isSort: false, width: 50, frozen: true, render: function (rowdata, rowindex, value) {
                        return "<a href='javascript:deleteRow(" + rowindex + ","+rowdata.AuthID+")'>移除</a> ";
                    }
                },{
                    display: '授权号', name: 'AuthID', width: 100, frozen: true,render: function (rowdata, rowindex, value) {
                        return InitCell(rowdata, rowindex, value, 'AuthID');
                    }
                },{
                    display: '门店类型', name: 'StoreType', width: 100, frozen: true,render: function (rowdata, rowindex, value) {
                        return InitCell(rowdata, rowindex, value, 'StoreType');
                    }
                },{
                    display: '设备终止协议版本', name: 'devices.DeviceCancel.DeviceCancelContractSN',frozen: true, width: 160, align: 'left',render: function (rowdata, rowindex, value) {
                        return InitCell_cancel(rowdata, rowindex, value, 'DeviceCancelContractSN');
                    }
                }, {
                    display: '设备终止协议类型', name: 'devices.DeviceCancel.DeviceCancelContractType', width: 150,render: function (rowdata, rowindex, value) {
                        return InitCell_cancel(rowdata, rowindex, value, 'DeviceCancelContractType');
                    }
                }, {
                    display: '协议起始日期', name: 'devices.DeviceCancel.DeviceCancelContractBeginDate', width: 100,render: function (rowdata, rowindex, value) {
                        return InitCell_cancel(rowdata, rowindex, value, 'DeviceCancelContractBeginDate');
                    }
                }
                 ,{
                     display: '设备合同版本号', name: 'devices.DeviceContractSN', width: 160,render: function (rowdata, rowindex, value) { 
                         return InitCell2(rowdata, rowindex, value, 'DeviceContractSN');
                     }
                 }, {
                     display: '设备合同类型', name: 'devices.DeviceContractType', width: 150,render: function (rowdata, rowindex, value) {
                         return InitCell2(rowdata, rowindex, value, 'DeviceContractType');
                     }
                 }, {
                     display: '合同起始日期', name: 'devices.DeviceContractBeginDate', width: 100,render: function (rowdata, rowindex, value) {
                         return InitCell2(rowdata, rowindex, value, 'DeviceContractBeginDate');
                     }
                 }
                ],
                width: '100%', height: '70%', usePager: false,
                // 设置数据源
                dataAction: 'server', rownumbers: true, data: { Rows: <%=stores_json%> },
                //url: "AjaxTools/Handler.ashx?action=get_smd_store", 
                onAfterShowData: function(currentData) {
                    setTimeout(function() {
                        $("span[tooltip='true']").qtip({
                            position: {
                                target: 'mouse',
                                adjust: { x: 10, y: 10 }
                            }
                        });
                    }, 500);
                },
                onDblClickRow: function (data, rowindex, rowobj) {
                    if(isDblClickRow) {
                        if(data.devices!=null && data.devices.length>0)
                        {

                            if (data.StoreCancel != null) {
                                openContractDialog(530);
                            } else {
                                openContractDialog(430);
                            }
                        }
                        
                        else
                        {
                            openContractDialog(300); // 20161222 如果没有设备，则不弹出“合同信息”弹出框，因为门店合同也已经取消
                        } 
                        var step = "<%:step.Trim() %>";
                        if(step != "Manager Approve" && step != "readOnly")
                        {
                            $.jBox.getBox().find(".qgqy").each(function(){
                                $(this).hide();
                            });
                        }
                        if(step == "readOnly" || step == "DMO Commit"){
                            storegrid.toggleCol('remove', false);
                            $.jBox.getBox().find(".readOnly").each(function(){
                                $(this).attr("readonly","readonly");
                                $(this).addClass("readonly");
                            });
                            $.jBox.getBox().find(".ck").each(function(){
                                $(this).attr("disabled","true");
                            });
                            $.jBox.getBox().find(".ddl").each(function(){
                                $(this).attr("disabled","true");
                            });
                            $.jBox.getBox().find('input:radio').each(function(){
                                $(this).attr("disabled","true");
                            });
                            $.jBox.getBox().find('input:checkbox').each(function(){
                                $(this).attr("disabled","true");
                            });
                            $.jBox.getBox().find(".jbox-button").each(function(){
                                $(this).css("display","none");
                            });
                        }
                        if(data.devices!=null && data.devices.length>0)
                        {
                         if(data.StoreType=="MT"){ //20170104 当门店类型为MT时才签设备合同
                                $.jBox.getBox().find("#deviceContract").css("display","");
                          }
                            $.jBox.getBox().find("#deviceCancelContract").css("display","");
                            for(var i=data.devices.length-1;i>=2;i--) {
                                
                                var html = "<tbody id='deviceContract"+i+"'>"+$.jBox.getBox().find("#deviceContract").html()+"</tbody>";
                                if(data.devices[i].DeviceCancel != null){
                                    var html1 = "<tbody id='deviceContract"+i+"'>"+$.jBox.getBox().find("#deviceCancelContract").html()+"</tbody>";
                                    html = html1 + html;
                                }
                                $.jBox.getBox().find("#deviceContract").after(html);
                            }
                        }
                        /*门店终止 st*/
                        $.jBox.getBox().find(":hidden[name='StoreID']").val(data.StoreID);
                        $.jBox.getBox().find(":hidden[name='AuthID']").val(data.AuthID);
                        $.jBox.getBox().find(":hidden[name='StoreType']").val(data.StoreType);
                        if(data.contract != null && data.contract.StoreCancel != null) {
                            $.jBox.getBox().find(":hidden[name='ContractCancelID']").val(data.contract.StoreCancel.ContractCancelID);
                            $.jBox.getBox().find(":hidden[name='StoreID']").val(data.StoreID);
                            $.jBox.getBox().find(":hidden[name='AuthID']").val(data.contract.StoreCancel.AuthID);
                            $.jBox.getBox().find("[name='StoreCancelContractSN']").val(data.contract.StoreCancel.StoreCancelContractSN);
                            $.jBox.getBox().find("[name='StoreCancelDeposit']").val(data.contract.StoreCancel.StoreCancelDeposit);
                            $.jBox.getBox().find("[name='StoreCancelContractType']").val(data.contract.StoreCancel.StoreCancelContractType);
                            $.jBox.getBox().find("[name='StoreCancelContractBeginDate']").val(data.contract.StoreCancel.StoreCancelContractBeginDate);
                            $.jBox.getBox().find("[name='StoreCancelParty']").val(data.contract.StoreCancel.StoreCancelParty);
                            $.jBox.getBox().find("[name='StoreCancelContractEndDate']").val(data.contract.StoreCancel.StoreCancelContractEndDate);
                            $.jBox.getBox().find("[name='StoreCancelNature']").val(data.contract.StoreCancel.StoreCancelNature);
                            $.jBox.getBox().find("[name='StoreCancelAffiliation']").val(data.contract.StoreCancel.StoreCancelAffiliation);
                            $.jBox.getBox().find("[name='StoreCancelStamp']").val(data.contract.StoreCancel.StoreCancelStamp);
                            $.jBox.getBox().find("[name='StoreCancelCopies']").val("3");
                            $.jBox.getBox().find("[name='StoreCancelExpressDate']").val(data.contract.StoreCancel.StoreCancelExpressDate);
                            $.jBox.getBox().find("[name='StoreCancelEms']").val(data.contract.StoreCancel.StoreCancelEms);
                            $.jBox.getBox().find("[name='ToStoreCancelEms']").val(data.contract.StoreCancel.ToStoreCancelEms);
                            $.jBox.getBox().find("[name='StoreCancelArchive']").val(data.contract.StoreCancel.StoreCancelArchive);
                            $.jBox.getBox().find("[name='CancelRemark']").val(data.contract.StoreCancel.CancelRemark);
                            $.jBox.getBox().find("[name='StoreCancelFileNO']").val(data.contract.StoreCancel.StoreCancelFileNO);
                            $.jBox.getBox().find("[name='StoreCancelNotSignReason']").val(data.contract.StoreCancel.StoreCancelNotSignReason);
                            if(data.contract.StoreCancel.StoreCancelRegionReceive){
                                $.jBox.getBox().find("[name='StoreCancelRegionReceive']").attr("checked","checked");
                            }
                            if(data.contract.StoreCancel.StoreCancelNature == "无法签署"){
                                $.jBox.getBox().find(".tr_StoreCancelNoSign").show();
                                $.jBox.getBox().find("[name='StoreCancelRegionReceive']").css("datatype","*");
                            }

                            if(data.contract.StoreCancel.StoreCancelFinance == "True"){
                                $.jBox.getBox().find("#StoreFinance1").attr("checked","checked");
                                $.jBox.getBox().find("#StoreFinance2").removeAttr("checked");
                            }
                        }
                        
                        /*门店终止 ed*/
                        if(data.contract != null) {
                            /*门店合同 st*/
                            $.jBox.getBox().find(":hidden[name='ContractID']").val(data.contract.ContractID);
                            $.jBox.getBox().find("[name='StoreContractSN']").val(data.contract.StoreContractSN);
                            $.jBox.getBox().find("[name='StoreDeposit']").val(data.contract.StoreDeposit);
                            $.jBox.getBox().find("[name='StoreContractType']").val(data.contract.StoreContractType);
                            $.jBox.getBox().find("[name='StoreContractBeginDate']").val(data.contract.StoreContractBeginDate);
                            $.jBox.getBox().find("[name='StoreParty']").val(data.contract.StoreParty);
                            $.jBox.getBox().find("[name='StoreContractEndDate']").val(data.contract.StoreContractEndDate);
                            $.jBox.getBox().find("[name='AwardContractBeginDate']").val(data.contract.AwardContractBeginDate);
                            $.jBox.getBox().find("[name='AwardContractEndDate']").val(data.contract.AwardContractEndDate);
                            $.jBox.getBox().find("[name='HasTransferContract']").val(data.contract.HasTransferContract);
                            $.jBox.getBox().find("[name='TransferFromStoreAuthID']").val(data.contract.TransferFromStoreAuthID);
                            $.jBox.getBox().find("[name='TransferToStoreSN']").val(data.contract.TransferToStoreSN);
                            $.jBox.getBox().find("[name='TransferContractDate']").val(data.contract.TransferContractDate);
                            $.jBox.getBox().find("[name='HasRenewContract']").val(data.contract.HasRenewContract);
                            $.jBox.getBox().find("[name='RenewContractBeginDate']").val(data.contract.RenewContractBeginDate);
                            $.jBox.getBox().find("[name='RenewContractEndDate']").val(data.contract.RenewContractEndDate);
                            $.jBox.getBox().find("[name='StoreNature']").val(data.contract.StoreNature);
                            $.jBox.getBox().find("[name='StoreAffiliation']").val(data.contract.StoreAffiliation);
                            $.jBox.getBox().find("[name='StoreStamp']").val(data.contract.StoreStamp);
                            $.jBox.getBox().find("[name='StoreCopies']").val("3");
                            $.jBox.getBox().find("[name='StoreExpressDate']").val(data.contract.StoreExpressDate);
                            $.jBox.getBox().find("[name='StoreEms']").val(data.contract.StoreEms);
                            $.jBox.getBox().find("[name='ToStoreEms']").val(data.contract.ToStoreEms);
                            $.jBox.getBox().find("[name='StoreArchive']").val(data.contract.StoreArchive);
                            $.jBox.getBox().find("[name='Remark']").val(data.contract.Remark);
                            $.jBox.getBox().find("[name='StoreFileNO']").val(data.contract.StoreFileNO);
                            $.jBox.getBox().find("[name='StoreNotSignReason']").val(data.contract.StoreNotSignReason);
                            if(data.contract.StoreRegionReceive){
                                $.jBox.getBox().find("[name='StoreRegionReceive']").attr("checked","checked");
                            }
                            if(data.contract.StoreNature == "无法签署"){
                                $.jBox.getBox().find(".tr_StoreNoSign").show();
                                $.jBox.getBox().find("[name='StoreNotSignReason']").css("datatype","*");
                            }

                            if(data.contract.StoreFinance == "True"){
                                $.jBox.getBox().find("#StoreFinance1").attr("checked","checked");
                                $.jBox.getBox().find("#StoreFinance2").removeAttr("checked");
                            }
                        }
                        
                        /*门店合同 ed*/
                        /*设备合同 st*/
                        for(var j=0;j<data.devices.length;j++) {
                            if (data.devices[j].DeviceCancel != null) {
                                if(data.devices[j].DeviceCancel.DeviceCancelNature == "无法签署"){
                                    $.jBox.getBox().find(".tr_DeviceCancelNoSign").eq(j).show();
                                    $.jBox.getBox().find("[name='DeviceCancelNotSignReason']").eq(j).css("datatype","*");
                                }
                                $.jBox.getBox().find(":hidden[name='DeviceID']").eq(j+2*(j-1)).val(data.devices[j].DeviceCancel.DeviceID);
                                
                                $.jBox.getBox().find(":hidden[name='ContractDeviceCancelID']").eq(j).val(data.devices[j].DeviceCancel.ContractDeviceCancelID);
                                $.jBox.getBox().find("[name='DeviceCancelContractSN']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelContractSN);
                                $.jBox.getBox().find("[name='DeviceCancelContractType']").eq(j).val("设备终止投放及三方转移协议");//20170106 update data.devices[j].DeviceCancel.DeviceCancelContractType
                                $.jBox.getBox().find("[name='DeviceCancelContractBeginDate']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelContractBeginDate);
                                $.jBox.getBox().find("[name='DeviceCancelContractEndDate']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelContractEndDate);
                                $.jBox.getBox().find("[name='DeviceCancelFixAssetNo']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelFixAssetNo);
                                $.jBox.getBox().find("[name='DeviceCancelNature']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelNature);
                                $.jBox.getBox().find("[name='DeviceCancelAffiliation']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelAffiliation);
                                $.jBox.getBox().find("[name='DeviceCancelStamp']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelStamp);
                                $.jBox.getBox().find("[name='DeviceCancelParty']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelParty);
                                $.jBox.getBox().find("[name='DeviceCancelCopies']").eq(j).val("3");
                                $.jBox.getBox().find("[name='DeviceCancelExpressDate']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelExpressDate);
                                $.jBox.getBox().find("[name='DeviceCancelEms']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelEms);
                                $.jBox.getBox().find("[name='ToDeviceCancelEms']").eq(j).val(data.devices[j].DeviceCancel.ToDeviceCancelEms);
                                $.jBox.getBox().find("[name='DeviceCancelArchive']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelArchive);
                                $.jBox.getBox().find("[name='DeviceCancelRemark']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelRemark);
                                $.jBox.getBox().find("[name='DeviceCancelFileNO']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelFileNO);
                                $.jBox.getBox().find("[name='DeviceCancelNotSignReason']").eq(j).val(data.devices[j].DeviceCancel.DeviceCancelNotSignReason);
                                if(data.devices[j].DeviceCancel.DeviceRegionReceive)
                                {
                                    $.jBox.getBox().find("[name='DeviceCancelRegionReceive']").eq(j).attr("checked","checked");
                                }
                        
                                if(data.devices[j].DeviceCancel.DeviceFinance){
                                    $.jBox.getBox().find("#DeviceCancelFinance1").eq(j).attr("checked","checked");
                                    $.jBox.getBox().find("#DeviceCancelFinance2").eq(j).removeAttr("checked");
                                }

                                //切换版本号变更类型
                                $.jBox.getBox().find("[name='DeviceCancelContractSN']").eq(j).change(function(){
                                    if($.jBox.getBox().find("[name='DeviceCancelContractSN']").val()=="1306A"){
                                        $.jBox.getBox().find("[name='DeviceCancelContractType']").val("合同终止及三方转移合同");
                                    }else{
                                        $.jBox.getBox().find("[name='DeviceCancelContractType']").val("设备终止投放及三方转移协议");
                                    }
                               
                                });
                            }
                     
                            
                          

                            if(data.devices[j].DeviceNature == "无法签署"){
                                $.jBox.getBox().find(".tr_DeviceNoSign").eq(j).show();
                                $.jBox.getBox().find("[name='DeviceNotSignReason']").eq(j).css("datatype","*");
                            }
                            if (data.devices[j].DeviceCancel != null) {
                                
                                $.jBox.getBox().find(":hidden[name='DeviceID']").eq(j+2*(j-1)+1).val(data.devices[j].DeviceID);
                            }else
                            {
                                $.jBox.getBox().find(":hidden[name='DeviceID']").eq(j).val(data.devices[j].DeviceID);
                            }
                            
                            $("#hid_DeviceID").val(data.devices[j].DeviceID); //20170106 Add
                            $("#hid_StoreID").val(data.StoreID); //20170106 Add
                            $("#hid_ContractDeviceID").val(data.devices[j].ContractDeviceID); //20170106 Add
                            $.jBox.getBox().find(":hidden[name='StoreID']").eq(j).val(data.StoreID);
                            $.jBox.getBox().find(":hidden[name='ContractDeviceID']").eq(j).val(data.devices[j].ContractDeviceID);
                            $.jBox.getBox().find("[name='DeviceContractSN']").eq(j).val(data.devices[j].DeviceContractSN);//"MT-New-1701A"
                            $("#hid_DeviceContractSN").val(data.devices[j].DeviceContractSN); //20170106 Add
                            $.jBox.getBox().find("[name='DeviceDeposit']").eq(j).val(data.devices[j].DeviceDeposit);
                            $.jBox.getBox().find("[name='DeviceContractType']").eq(j).val(data.devices[j].DeviceContractType);//20170106 update
                            $("#hid_DeviceContractType").val(data.devices[j].DeviceContractType); //20170106 Add
                            $.jBox.getBox().find("[name='DeviceContractBeginDate']").eq(j).val(data.devices[j].DeviceContractBeginDate);
                            $.jBox.getBox().find("[name='DeviceContractEndDate']").eq(j).val(data.devices[j].DeviceContractEndDate);
                            $.jBox.getBox().find("[name='DeviceFixAssetNo']").eq(j).val(data.devices[j].DeviceFixAssetNo);
                            $("#hid_DeviceFixAssetNo").val(data.devices[j].DeviceFixAssetNo); //20170106 Add
                            $.jBox.getBox().find("[name='DeviceNature']").eq(j).val(data.devices[j].DeviceNature);
                            $.jBox.getBox().find("[name='DeviceAffiliation']").eq(j).val(data.devices[j].DeviceAffiliation);
                            $.jBox.getBox().find("[name='DeviceStamp']").eq(j).val(data.devices[j].DeviceStamp);
                            $.jBox.getBox().find("[name='DeviceParty']").eq(j).val(data.devices[j].DeviceParty);
                            $.jBox.getBox().find("[name='DeviceCopies']").eq(j).val("3");
                            $.jBox.getBox().find("[name='DeviceExpressDate']").eq(j).val(data.devices[j].DeviceExpressDate);
                            $.jBox.getBox().find("[name='DeviceEms']").eq(j).val(data.devices[j].DeviceEms);
                            $.jBox.getBox().find("[name='ToDeviceEms']").eq(j).val(data.devices[j].ToDeviceEms);
                            $.jBox.getBox().find("[name='DeviceArchive']").eq(j).val(data.devices[j].DeviceArchive);
                            $.jBox.getBox().find("[name='DeviceRemark']").eq(j).val(data.devices[j].DeviceRemark);
                            $.jBox.getBox().find("[name='DeviceFileNO']").eq(j).val(data.devices[j].DeviceFileNO);
                            $.jBox.getBox().find("[name='DeviceNotSignReason']").eq(j).val(data.devices[j].DeviceNotSignReason);
                            if(data.devices[j].DeviceRegionReceive)
                            {
                                $.jBox.getBox().find("[name='DeviceRegionReceive']").eq(j).attr("checked","checked");
                            }
                        
                            if(data.devices[j].DeviceFinance){
                                $.jBox.getBox().find("#DeviceFinance1").eq(j).attr("checked","checked");
                                $.jBox.getBox().find("#DeviceFinance2").eq(j).removeAttr("checked");
                            }
                            /*设备合同 ed*/
                        }
                   
                    }
                }

               
            });

            /* 初始化单元格 st */
            function InitCell(rowdata, rowindex, value, name) {
                var h = value;

                for (var l in update_logs) {
                 
                    if (rowdata.contract != null &&(update_logs[l].DataID == rowdata.contract.ContractID)  && update_logs[l].FieldName == name) {
                        var id = rowdata.__id + rowdata.__index;

                        var title = "<b>修改前：</b><br />" + update_logs[l].BeforeValue;
                        title += "<br /><b>修改后:</b><br />" + update_logs[l].AfterValue;

                        h = "<span id='" + id + "' tooltip='true' class='updated' title='" + title + "'>" + 
                             update_logs[l].AfterValue + "</span>";
                    }
                }
                return h;
            }

            function InitCell2(rowdata, rowindex, value, name) {
                var h = value;
                //20170105  非卖场只显示终止合同信息
                if(rowdata.StoreType!="MT"){
                    return h;
                }
                //2016-11-29 update 展示门店合同版本号信息调整为对应设备合同版本号
                if(rowdata.devices != null){
                    var id = rowdata.__id + rowdata.__index;
                    for (var i = 0; i < rowdata.devices.length; i++) {
                        if(rowdata.devices[i][name]!=null && rowdata.devices[i][name]!=undefined){
                            h ="<span id='" + id + "' tooltip='true' title='" +  rowdata.devices[i][name] + "'>" + 
                                                     rowdata.devices[i][name] + "</span>";
                        }
                    }  
                } 
                return h;
            }

            function InitCell_cancel(rowdata, rowindex, value, name) {
                var h = value;
                //2016-11-29 update 展示门店合同版本号信息调整为对应设备合同版本号
                if(rowdata.devices != null){
                    var id = rowdata.__id + rowdata.__index;
                    
                    for (var i = 0; i < rowdata.devices.length; i++) {

                        if(rowdata.devices[i].DeviceCancel!=null){
                       
                            if(rowdata.devices[i].DeviceCancel[name]!=null && rowdata.devices[i].DeviceCancel[name]!=undefined){
                                h ="<span id='" + id + "' tooltip='true' title='" +  rowdata.devices[i].DeviceCancel[name] + "'>" + 
                                                        rowdata.devices[i].DeviceCancel[name]+ "</span>";
                            } }
                    }  
                } 
                return h;
            }


            /* 初始化tip ed */
            var step = "<%:step.Trim() %>";
            if(step == "DMO Commit" || step == "readOnly") {
                //isDblClickRow = false;
                storegrid.toggleCol('remove', false);
            }
    

            
            
        });

        /* 格式化json st */
        function formatJson(jsonObj) {
            var jsonStr = "{";
            $.each(jsonObj, function (i, field) {
                var s = i == 0 ? "\"" : ", \"";
                jsonStr += s + field.name + '":"' + field.value + '" ';
            });
            jsonStr += "}"
            return jsonStr;
        }
        /* 格式化json st */

        /* 提交表单 st */
        function confirmSubmit() {
            if (window.confirm("确认要提交吗？")) {
                $.jBox.tip('正在处理，请稍等...', 'loading');
                return true;
            }
            return false;
        }
        /* 提交表单 ed */

        /* 暂存表单 st */
        function confirmSave() {
            $.jBox.tip('正在保存，请稍等...', 'loading');
            return true;
        }
        /* 暂存表单 ed */

        /* 省份、城市 st */
        function initProvince(arg, callback) {
            var val = $(arg).val();
            var id = $(arg).attr("id");
            if ($.trim(val)) {
                $.ajax({
                    type: 'POST',
                    url: '<%=Page.ResolveUrl("~/pages/smd/store.aspx?action=initProvince")%>',
                    data: { ar: val },
                    dataType: "json",
                    cache: false,
                    success: function (json) {
                        var rst = json.navTabId.split("|");
                        var html = "";
                        for (var i = 0; i < rst.length; i++) {
                            if (rst[i]) {
                                var list = rst[i].split(",");
                                html += "<option value='" + list[0] + "'>" + list[1] + "</option>";
                            }
                        }
                        if (id == "Province") {
                            $("#CityName").find("option:gt(0)").remove().end().append(html);

                        }
                        else {
                            $("#Province").find("option:gt(0)").remove().end().append(html);
                            $("#CityName").find("option:gt(0)").remove();
                        }

                        if (jQuery.isFunction(callback)) {
                            callback();
                        }
                    }
                });
            }
            else {
                if (id == "Province") {
                    $("#CityName").find("option:gt(0)").remove();
                }
                else {
                    $("#Province").find("option:gt(0)").remove();
                    $("#CityName").find("option:gt(0)").remove();
                }
            }
        }
        /* 省份、城市 ed */


        /* 打开选择门店窗体 st */
        function openContractDialog(height) {
        
            $.jBox("id:editContract", {
                title: "修改合同信息（提交前请检查带出的数据,确保数据正确!）",
                width: 950,
                height: height,
                buttons: {'确认修改': 1, '取消修改': 0},
                submit: function (v, h, f) {
                    if (v == 0) {
                        return true; // close the window
                    }
                    else {
                        // 更新grid数据
                        var $form = $('<form id="f1"></form>');
                        $form.append($.jBox.getBox().find(".jbox-container .formTable").clone());
                        var required = true;
                        $.jBox.getBox().find("#editContract").find("[datatype='*']").each(function(){
                            if(!$(this).val()){
                                required = false;
                            }
                        });
                        if(!required){
                            $.jBox.tip("请填写完整后提交", 'error');
                            return false;
                        }
                        var jsonStr = formatJson($form.serializeArray());
                        var $storeType = $('<form id="f1"></form>');
                        $storeType.append($.jBox.getBox().find(".jbox-container #storeContractAll").clone());
                        var storeJsonStr = formatJson($storeType.serializeArray());
                        storeJsonStr = storeJsonStr.substring(0,storeJsonStr.length-1)+",";
                        var $storeForm = $('<form id="f1"></form>');
                        //设备序列号
                        var jsonDevice = "\"devices\":[";
                        //循环设备合同
                        if($.jBox.getBox().find("[id^=deviceContract]").length>0 && $.jBox.getBox().find("[id^=deviceContract]").eq(0).css("display") != "none"){
                            for(var i=0; i<$.jBox.getBox().find("[id^=deviceContract]").length;i++){
                                var $deviceForm = $('<form id="f1"></form>');
                                $deviceForm.append($.jBox.getBox().find("[id^=deviceContract]").eq(i).clone());
                                var deviceJsonStr = formatJson($deviceForm.serializeArray());
                                jsonDevice += deviceJsonStr;
                                //如果有设备终止
                                if ($.jBox.getBox().find(":hidden[name='ContractDeviceCancelID']").val() != null && $.jBox.getBox().find(":hidden[name='ContractDeviceCancelID']").val() != "") {
                                    var $deviceCancelForm = $('<form id="f1"></form>');
                                    $deviceCancelForm.append($.jBox.getBox().find("[id=deviceCancelContract]").clone());
                                    var deviceCancelStr = formatJson($deviceCancelForm.serializeArray());
                                    jsonDevice = jsonDevice.substring(0,jsonDevice.length-1);
                                    jsonDevice +=",\"DeviceCancel\":" + deviceCancelStr+"}";
                                }
                                if(i != $.jBox.getBox().find("[id^=deviceContract]").length-1)
                                {
                                    jsonDevice += ",";
                                }
                            }
                        }else{ 
                            //给默认的设备合同信息,该信息无效（没有任何意义,只是为了隐藏设备合同后对其他无异常） 20170106 Add
                            var hid_DeviceContractSN =    $("#hid_DeviceContractSN").val();
                            var hid_DeviceFixAssetNo = $("#hid_DeviceFixAssetNo").val();
                            var hid_DeviceContractType = $("#hid_DeviceContractType").val();
                            var hid_DeviceID = $("#hid_DeviceID").val();
                            var hid_StoreID = $("#hid_StoreID").val();
                            var hid_ContractDeviceID = $("#hid_ContractDeviceID").val();
                            jsonDevice+="{\
                                         \"DeviceContractSN\": \""+hid_DeviceContractSN+"\",\
                                        \"DeviceID\": \""+hid_DeviceID+"\",\
                                        \"StoreID\": \""+hid_StoreID+"\",\
                                        \"ContractDeviceID\": \""+hid_ContractDeviceID+"\",\
                                        \"DeviceFixAssetNo\": \""+hid_DeviceFixAssetNo+"\",\
                                        \"DeviceContractBeginDate\": \"1900-01-01\",\
                                        \"DeviceContractType\": \""+hid_DeviceContractType+"\",\
                                        \"DeviceNature\": \"新签\",\
                                        \"DeviceAffiliation\": \"上海\",\
                                        \"ToDeviceEms\": \"\",\
                                        \"DeviceNotSignReason\": \"\",\
                                        \"DeviceParty\": \"阿克苏诺贝尔太古漆油（上海）有限公司\",\
                                        \"DeviceCopies\": \"3\",\
                                        \"DeviceFileNO\": \"\",\
                                        \"DeviceExpressDate\": \"\",\
                                        \"DeviceEms\": \"\",\
                                        \"DeviceFinance\": \"True\",\
                                        \"DeviceArchive\": \"\",\
                                        \"DeviceRemark\": \"\",";
                            //20170105 Add 当门店类型不为MT,只签设备终止合同
                            if ($.jBox.getBox().find(":hidden[name='ContractDeviceCancelID']").val() != null && $.jBox.getBox().find(":hidden[name='ContractDeviceCancelID']").val() != "") {
                                var $deviceCancelForm = $('<form id="f1"></form>');
                                $deviceCancelForm.append($.jBox.getBox().find("[id=deviceCancelContract]").clone());
                                var deviceCancelStr = formatJson($deviceCancelForm.serializeArray());
                                jsonDevice = jsonDevice.substring(0,jsonDevice.length-1);
                                jsonDevice +=",\"DeviceCancel\":" + deviceCancelStr+"}";
                            }
                        }
                        jsonDevice += "]";


                        //=======================
                        //var jsonDevice = "\"devices\":[";
                   
                        //jsonDevice += "]";

                        //=========================
                        var aa =$.jBox.getBox().find("[id^=deviceContract]");
                        if($.jBox.getBox().find("[id^=deviceContract]").length==0 || $.jBox.getBox().find("[id^=deviceContract]")==null || $.jBox.getBox().find("[id^=deviceContract]")==undefined ) {
                            jsonStr = storeJsonStr;
                        } else {
                            storeJsonStr = storeJsonStr.substring(0,storeJsonStr.length-1);
                            jsonStr = storeJsonStr + "," + jsonDevice+"}";
                        }
                        storegrid.updateRow(storegrid.getSelected(), jQuery.parseJSON(jsonStr));
                        // 提交并保存变更的数据
                        $.ajax({
                            type: 'POST',
                            url: '<%= Page.ResolveUrl("~/Pages/SMD/ajaxtools/handler.ashx?action=save_changed_contract")%>',
                            data: { data: JSON.stringify(storegrid.getSelected()) },
                            //data: { data: jsonStr },
                            dataType: "json",
                            success: function (json) {
                                update_logs = json;
                                storegrid.reload();


                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                                console.log(XMLHttpRequest.status);
                                console.log(XMLHttpRequest.readyState);
                                console.log(textStatus);
                            }
                        });
                    }
                    return true;
                }
            });
        }


        /* 删除行 st */
        function deleteRow(rowid,contractId) {
            if (confirm('确定移除?')) {
                $.ajax({
                    type: 'POST',
                    url: '<%= Page.ResolveUrl("~/Pages/SMD/ajaxtools/handler.ashx?action=delete_changed_contract")%>',
                    data: { id: contractId },
                    success: function (result) {
                        storegrid.deleteRow(rowid);
                    },
                    error: function (result) {
                        $.jBox.tip(result, 'error');
                    }
                });
            }
        }
        /* 删除行 ed */

        /* 选择变更的数据 st */
        function selectData() {
            var storeIds = [];
            var storejson = storegrid.getData();
            for(var o in storejson) {
                storeIds.push(storejson[o].ContractID);
            }

            var fn = $.ligerui.getPopupFn({
                condition:{
                    fields: [{ name: 'keyword',labelWidth:180,label: '门店授权号/门店合同版本号',type:"text",op:'like',title:'请输入关键字'}]
                },

                top : 80,
                onSelect: function (e) {
                    storegrid.addRows(e.data);
                },
                grid: {columns: [{
                    display: '授权号', name: 'AuthID', width: 100
                }
                //, {
                //    display: '门店合同编号', name: 'contract.StoreContractSN', width: 160, align: 'left'
                //}, {
                //    display: '店面合同类型', name: 'contract.StoreContractType', width: 100
                //}, {
                //    display: '合同起始日期', name: 'contract.StoreContractBeginDate', width: 100
                //}, {
                //    display: '合同到期日期', name: 'contract.StoreContractEndDate', width: 100
                //}
                , {
                    display: '设备合同编号', name: 'contract.DeviceContractSN', width: 100
                }, {
                    display: '调色机保证金余额', name: 'contract.DeviceDeposit', width: 100
                }, {
                    display: '设备合同类型', name: 'contract.DeviceContractType', width: 100
                }, {
                    display: '设备合同起始', name: 'contract.DeviceContractBeginDate', width: 100
                }, {
                    display: '设备合同到期', name: 'contract.DeviceContractEndDate', width: 100
                }],
                    width: '100%', height: '70%',checkbox:true,
                    // 设置数据源
                    dataAction: 'server', url: "AjaxTools/Handler.ashx?action=get_smd_Contract&taskid=<%=TaskAPI.TaskID%>&storeids="+storeIds.join(","), rownumbers: true
                    }
                });

                fn();
            }
            /* 选择变更的数据 ed */
            $(function(){
                $("label[for]").css("width","auto");
            });

    </script>
</head>
<body>
    <div class="flowpage">
        <form id="form1" runat="server">
            <!-- 标题 st -->
            <uc1:uc_head ID="uc_head1" runat="server" />
            <!-- 标题 ed -->

            <!-- 表单内容 st -->
            <div>
                <a href="javascript:;" onclick="selectData()" id="lb_selectData" runat="server" class="u-btn seachStore">选取合同</a>
            </div>
            <div style="margin: 10px 0;">
                <div id="storegrid" style="margin-bottom: 5px;"></div>
                <table class="formTable">
                    <!-- 审批列表 st -->
                    <tbody id="assessment" runat="server" visible="false">
                        <tr>
                            <td class="title" colspan="2">审批列表</td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <uc:DwzAssessmentList ID="DwzAssessmentList1" runat="server" />
                            </td>
                        </tr>
                    </tbody>
                    <!-- 审批列表 ed -->
                    <tbody id="FileUpload" runat="server" visible="True">
                        <tr>
                            <th colspan="2" class="title"><span style="color: red">如果勾选了区域收到，请提交收到快递后的确认邮件</span></th>
                        </tr>
                        <tr>
                            <th colspan="2" class="title">附件上传</th>
                        </tr>
                        <tr>
                            <th>相关附件：
                            </th>
                            <td>
                                <uc:ajaxUpload ID="AjaxUpload1" runat="server" />
                                <asp:Literal ID="Literal1" runat="server"></asp:Literal>
                            </td>
                        </tr>
                    </tbody>
                    <!-- 字段变更列表 st -->
                    <tbody id="changelogs" runat="server" visible="false">
                        <tr>
                            <th>字段变更列表：</th>
                            <td>
                                <uc:uc_change_field ID="uc_change_field1" runat="server" />
                            </td>
                        </tr>
                    </tbody>
                    <!-- 字段变更列表 ed -->
                    <!-- 审批意见 st -->
                    <tbody>
                        <uc:DwzAssessment ID="DwzAssessment1" runat="server" />
                    </tbody>
                    <!-- 审批意见 ed -->
                </table>

                <%  if (H2.NET.Common.AksRequest.GetString("showbtn") != "0")
                    { %>
                <div style="margin: 5px; padding-bottom: 10px; text-align: center;">
                    <asp:Button ID="btn_submit" runat="server" CssClass="u-btn" Text="提交(Submit)" OnClick="btn_submit_Click" OnClientClick="return confirmSubmit();" />
                    <asp:Button ID="btn_save" runat="server" CssClass="u-btn" Text="暂存(Save)" OnClick="btn_Save_Click" OnClientClick="return confirmSave();" />
                    <input type="button" class="u-btn u-btn-c4" value="关闭(Close)" onclick="custom_close()" />
                    <asp:HyperLink ID="hl_ExportPdf" runat="server" Visible="false" Target="_blank" CssClass="u-btn u-btn-c3" Style="height: 28px; line-height: 28px; display: inline-block;">生成(PDF)</asp:HyperLink>
                    <asp:Button ID="btn_print" runat="server" CssClass="u-btn u-btn-c2" Text="打印(Print)" OnClientClick="window.print()" Visible="false" />
                </div>
                <%  } %>
            </div>
            <!-- 表单内容 ed -->

            <!-- 修改页面 st -->
            <div id="editContract" style="margin: 5px; height: auto; display: none">
                <script type="text/javascript">
                    /*
                    合同性质改变
                    */
                    function onNatureChange(obj, type) {
                        if (obj.value == "无法签署") {
                            if (type == "store") {
                                $.jBox.getBox().find(".tr_StoreNoSign").show();
                                $.jBox.getBox().find("[name='StoreNotSignReason']").attr("datatype", "*");
                            } else {
                                $(obj).parent().parent().next().css("display", "");
                                $.jBox.getBox().find("[name='DeviceNotSignReason']").attr("datatype", "*");
                            }
                        } else {
                            if (type == "store") {
                                $.jBox.getBox().find(".tr_StoreNoSign").hide();
                                $.jBox.getBox().find("[name='StoreNotSignReason']").removeAttr("datatype");
                            } else {
                                $(obj).parent().parent().next().css("display", "none");
                                $.jBox.getBox().find("[name='DeviceNotSignReason']").removeAttr("datatype");
                            }
                        }
                    }
                
                    /*
                    终止合同性质改变
                    */
                    function onNatureCancelChange(obj, type) {
                        if (obj.value == "无法签署") {
                            if (type == "store") {
                                $.jBox.getBox().find(".tr_StoreCancelNoSign").show();
                                $.jBox.getBox().find("[name='StoreCancelNotSignReason']").attr("datatype", "*");
                            } else  if(type == "device"){
                                $.jBox.getBox().find(".tr_DeviceCancelNoSign").show();
                                $.jBox.getBox().find("[name='DeviceCancelNotSignReason']").attr("datatype", "*");
                            }
                        } else {
                            if (type == "store") {
                                $.jBox.getBox().find(".tr_StoreCancelNoSign").hide();
                                $.jBox.getBox().find("[name='StoreCancelNotSignReason']").removeAttr("datatype");
                            } else  if(type == "device"){
                                $.jBox.getBox().find(".tr_DeviceCancelNoSign").hide();
                                $.jBox.getBox().find("[name='DeviceCancelNotSignReason']").removeAttr("datatype");
                            }
                        }
                    }

                    function changeValue(remark) {
                        $(remark).val($(remark).val().replace("	", " "));
                    }
                </script>
                <!-- 合同信息 st -->
                <table class="formTable">
                    <tbody style="display:none" id="storeContractAll" runat="server">
                        <tr>
                            <td>
                                <input type="hidden" name="StoreType"/>
                                <input type="hidden" name="StoreID"/>
                                <input type="hidden" name="AuthID"/>
                            </td>
                        </tr>
                    </tbody>
                <%--   2016-11-08 （隐藏门店合同变更）--%>
                     <tbody id="storeCancelContract" style="display:none" runat="server">
                        <tr>
                            <td class="title" colspan="6">门店终止合同信息<font style="color:red">--<%:oldDealer %></font>
                            </td>
                        </tr>
                        <tr>
                            <th>
                                <asp:HiddenField ID="ContractCancelID" runat="server" />
                                <input type="hidden" name="StoreID" />
                                <input type="hidden" name="AuthID"/>
                                门店合同版本号：
                            </th>
                            <td>
                                <asp:DropDownList ID="StoreCancelContractSN" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>门店合同类型：
                            </th>
                            <td>
                                <asp:DropDownList CssClass="ck" ID="StoreCancelContractType" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>合同起始日期：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreCancelContractBeginDate" CssClass="Wdate({maxDate:'%y-%M-%d'}) readOnly" onfocus="WdatePicker()"
                                    runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <th>合同性质：
                            </th>
                            <td>
                                <asp:DropDownList ID="StoreCancelNature" CssClass="ddl" runat="server" onchange="onNatureCancelChange(this,'store')">
                                </asp:DropDownList>
                            </td>
                            <th>合同归属：
                            </th>
                            <td>
                                <asp:DropDownList ID="StoreCancelAffiliation" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>寄出快递单号：
                            </th>
                            <td>
                                <asp:TextBox ID="ToStoreCancelEms" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr_StoreCancelNoSign" style="display: none">
                            <th>无法签署合同原因：
                            </th>
                            <td colspan="5">
                                <asp:TextBox ID="StoreCancelNotSignReason" CssClass="readOnly" runat="server" Style="width: 80%"></asp:TextBox>
                                <asp:Label ID="l_StoreCaneclNotSignReason" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <th>甲方：
                            </th>
                            <td>
                                <asp:DropDownList ID="StoreCancelParty" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>合同份数：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreCancelCopies" CssClass="readOnly" runat="server" Style="display: none"></asp:TextBox>
                                <asp:Label ID="l_StoreCancelCopies" runat="server">3</asp:Label>
                            </td>
                            <th>存档号：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreCancelFileNO" CssClass="readOnly" runat="server"></asp:TextBox>
                                <asp:Literal ID="l_StoreCancelFileNO" runat="server"></asp:Literal>
                            </td>
                        </tr>
                        <tr class="qgqy">
                            <th>快递日期：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreCancelExpressDate" CssClass="Wdate ck" onfocus="WdatePicker({maxDate:'%y-%M-%d'})" runat="server"></asp:TextBox>
                            </td>
                            <th>EMS单号：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreCancelEms" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                            <th>递交财务：
                            </th>
                            <td>
                                <asp:RadioButton GroupName="StoreCancelFinance" CssClass="ck" ID="RadioButton1" runat="server" Text="是"
                                    value="True" />
                                <asp:RadioButton GroupName="StoreCancelFinance" CssClass="ck" ID="RadioButton2" runat="server" Checked="true"
                                    Text="否" value="False" />
                                <asp:Literal ID="Literal2" runat="server"></asp:Literal>
                            </td>
                        </tr>
                        <tr class="qgqy">
                            <th>合同归档号：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreCancelArchive" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                            <th>区域收到：
                            </th>
                            <td colspan="3">
                                <asp:CheckBox ID="cb_StoreCancelRegionReceive" CssClass="ck" runat="server" onclick="" />
                                <label style="margin-right: 10px; color: Red">备注：勾选该项后，请提交收到快递后的确认邮件</label>
                            </td>
                        </tr>
                        <tr>
                            <th>备注：
                            </th>
                            <td colspan="5">
                                <asp:TextBox ID="CancelRemark" CssClass="readOnly" onblur="changeValue(this)" runat="server" Width="300px"></asp:TextBox>
                            </td>
                        </tr>
                    </tbody>
                 <%--   2016-11-08 （隐藏门店合同变更）--%>
                      <tbody id="storeContract" style="display:none"  runat="server">
                        <tr>
                            <td class="title" colspan="6">门店合同信息<font style="color:red">--<%:newDealer %></font>
                            </td>
                        </tr>
                        <tr>
                            <th>
                                <asp:HiddenField ID="ContractID" runat="server" />
                                <asp:HiddenField ID="StoreID" runat="server" />
                                <input type="hidden" name="AuthID" />
                                门店合同版本号：
                            </th>
                            <td>
                                <asp:DropDownList ID="StoreContractSN" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>门店合同类型：
                            </th>
                            <td>
                                <asp:DropDownList CssClass="ck" ID="StoreContractType" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>合同起始日期：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreContractBeginDate" CssClass="Wdate({maxDate:'%y-%M-%d'}) readOnly" onfocus="WdatePicker()"
                                    runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <th>合同性质：
                            </th>
                            <td>
                                <asp:DropDownList ID="StoreNature" CssClass="ddl" runat="server" onchange="onNatureChange(this,'store')">
                                </asp:DropDownList>
                            </td>
                            <th>合同归属：
                            </th>
                            <td>
                                <asp:DropDownList ID="StoreAffiliation" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>寄出快递单号：
                            </th>
                            <td>
                                <asp:TextBox ID="ToStoreEms" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr_StoreNoSign" style="display: none">
                            <th>无法签署合同原因：
                            </th>
                            <td colspan="5">
                                <asp:TextBox ID="StoreNotSignReason" CssClass="readOnly" runat="server" Style="width: 80%"></asp:TextBox>
                                <asp:Label ID="l_StoreNotSignReason" runat="server"></asp:Label>
                            </td>
                        </tr>
                        <tr>
                            <th>甲方：
                            </th>
                            <td>
                                <asp:DropDownList ID="StoreParty" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>合同份数：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreCopies" CssClass="readOnly" runat="server" Style="display: none"></asp:TextBox>
                                <asp:Label ID="l_StoreCopies" runat="server">3</asp:Label>
                            </td>
                            <th>存档号：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreFileNO" CssClass="readOnly" runat="server"></asp:TextBox>
                                <asp:Literal ID="l_StoreFileNO" runat="server"></asp:Literal>
                            </td>
                        </tr>
                        <tr class="qgqy">
                            <th>快递日期：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreExpressDate" CssClass="Wdate ck" onfocus="WdatePicker({maxDate:'%y-%M-%d'})" runat="server"></asp:TextBox>
                            </td>
                            <th>EMS单号：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreEms" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                            <th>递交财务：
                            </th>
                            <td>
                                <asp:RadioButton GroupName="StoreFinance" CssClass="ck" ID="StoreFinance1" runat="server" Text="是"
                                    value="True" />
                                <asp:RadioButton GroupName="StoreFinance" CssClass="ck" ID="StoreFinance2" runat="server" Checked="true"
                                    Text="否" value="False" />
                                <asp:Literal ID="l_StoreFinance" runat="server"></asp:Literal>
                            </td>
                        </tr>
                        <tr class="qgqy">
                            <th>合同归档号：
                            </th>
                            <td>
                                <asp:TextBox ID="StoreArchive" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                            <th>区域收到：
                            </th>
                            <td colspan="3">
                                <asp:CheckBox ID="cb_StoreRegionReceive" CssClass="ck" runat="server" onclick="" />
                                <label style="margin-right: 10px; color: Red">备注：勾选该项后，请提交收到快递后的确认邮件</label>
                            </td>
                        </tr>
                        <tr>
                            <th>备注：
                            </th>
                            <td colspan="5">
                                <asp:TextBox ID="Remark" CssClass="readOnly" onblur="changeValue(this)" runat="server" Width="300px"></asp:TextBox>
                            </td>
                        </tr>
                    </tbody>
                    <tbody id="deviceCancelContract" runat="server" style="display:none">
                         <tr>
                            <td class="title" colspan="6">设备终止合同信息<font style="color:red">--<%:oldDealer %></font>
                            </td>
                        </tr>
                        <tr>
                            <th>设备合同版本号：
                            </th>
                            <td>
                                <asp:DropDownList ID="DeviceCancelContractSN" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                                <input type="hidden" name="ContractDeviceCancelID" />
                                <input type="hidden" name="DeviceID" />
                            </td>
                            <th>设备固定资产号：
                            </th>
                            <td colspan="3">
                                <asp:TextBox ID="DeviceCancelFixAssetNo" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>

                        </tr>
                        <tr>
                            <th>设备合同起始日期：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceCancelContractBeginDate" CssClass="Wdate readOnly" onfocus="WdatePicker({maxDate:'%y-%M-%d'})"
                                    runat="server"></asp:TextBox>
                            </td>
                            <th>设备合同类型：
                            </th>
                            <td colspan="3">
                                <asp:DropDownList ID="DeviceCancelContractType" CssClass="ddl" runat="server" >
                                </asp:DropDownList>
                                <asp:Literal ID="l_DeviceCancelContractType" runat="server"></asp:Literal>
                            </td>
                        </tr>
                        <tr>
                            <th>合同性质：
                            </th>
                            <td>
                                <asp:DropDownList ID="DeviceCancelNature" CssClass="ddl" runat="server" onchange="onNatureCancelChange(this,'device')">
                                </asp:DropDownList>
                            </td>
                            <th>合同归属：
                            </th>
                            <td>
                                <asp:DropDownList ID="DeviceCancelAffiliation" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>寄出快递单号：
                            </th>
                            <td>
                                <asp:TextBox ID="ToDeviceCancelEms" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr_DeviceCancelNoSign" style="display: none">
                            <th>无法签署合同原因：
                            </th>
                            <td colspan="5">
                                <asp:TextBox ID="DeviceCancelNotSignReason" CssClass="readOnly" runat="server" Style="width: 80%"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <th>甲方：
                            </th>
                            <td>
                                <asp:DropDownList ID="DeviceCancelParty" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>合同份数：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceCancelCopies" CssClass="readOnly" runat="server" Style="display: none"></asp:TextBox>
                                <asp:Label ID="l_DeviceCancelCopies" runat="server">3</asp:Label>
                            </td>
                            <th>存档号：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceCancelFileNO" CssClass="readOnly" runat="server"></asp:TextBox>
                                <asp:Literal ID="l_DeviceCancelFileNO" runat="server"></asp:Literal>
                            </td>
                        </tr>
                        <tr class="qgqy">
                            <th>快递日期：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceCancelExpressDate" CssClass="Wdate ck" onfocus="WdatePicker({maxDate:'%y-%M-%d'})" runat="server"></asp:TextBox>
                            </td>
                            <th>EMS单号：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceCancelEms" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                            <th>递交财务：
                            </th>
                            <td>
                                <asp:RadioButton GroupName="DeviceCancelFinance" CssClass="ck" ID="RadioButton3" runat="server" Text="是"
                                    value="True" />
                                <asp:RadioButton GroupName="DeviceCancelFinance" CssClass="ck" ID="RadioButton4" runat="server" Checked="true"
                                    Text="否" value="False" />
                            </td>
                        </tr>
                        <tr class="qgqy">
                            <th>合同归档号：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceCancelArchive" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                            <th>区域收到：
                            </th>
                            <td colspan="3">
                                <asp:CheckBox ID="cb_DeviceCancelRegionReceive" runat="server" CssClass="ck" onclick="" />
                                <label style="margin-right: 10px; color: Red">备注：勾选该项后，请提交收到快递后的确认邮件</label>
                            </td>
                        </tr>
                        <tr>
                            <th>备注：
                            </th>
                            <td colspan="5">
                                <asp:TextBox ID="DeviceCancelRemark" CssClass="readOnly" onblur="changeValue(this)" runat="server" Width="300px"></asp:TextBox>
                            </td>
                        </tr>
                    </tbody>
                    <tbody id="deviceContract" runat="server" style="display: none">
                        <tr>
                            <td class="title" colspan="6">设备合同信息<font style="color:red">--<%:newDealer %></font>
                            </td>
                        </tr>
                        <tr>
                            <th>设备合同版本号：
                            </th>
                            <td>
                                <asp:DropDownList ID="DeviceContractSN" CssClass="ddl" runat="server" >
                                </asp:DropDownList>
                                <input type="hidden" name="DeviceID"/>
                                <input type="hidden" name="StoreID"/> 
                                <asp:HiddenField ID="ContractDeviceID" runat="server" />
                            </td>
                            <th>设备固定资产号：
                            </th>
                            <td colspan="3">
                                <asp:TextBox ID="DeviceFixAssetNo" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>

                        </tr>
                        <tr>
                            <th>设备合同起始日期：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceContractBeginDate" CssClass="Wdate readOnly" onfocus="WdatePicker({maxDate:'%y-%M-%d'})"
                                    runat="server"></asp:TextBox>
                            </td>
                            <th>设备合同类型：
                            </th>
                            <td colspan="3">
                                <asp:DropDownList ID="DeviceContractType" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                                <asp:Literal ID="l_DeviceContractType" runat="server"></asp:Literal>
                            </td>
                        </tr>
                        <tr>
                            <th>合同性质：
                            </th>
                            <td>
                                <asp:DropDownList ID="DeviceNature" CssClass="ddl" runat="server" onchange="onNatureChange(this,'device')">
                                </asp:DropDownList>
                            </td>
                            <th>合同归属：
                            </th>
                            <td>
                                <asp:DropDownList ID="DeviceAffiliation" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>寄出快递单号：
                            </th>
                            <td>
                                <asp:TextBox ID="ToDeviceEms" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr class="tr_DeviceNoSign" style="display: none">
                            <th>无法签署合同原因：
                            </th>
                            <td colspan="5">
                                <asp:TextBox ID="DeviceNotSignReason" CssClass="readOnly" runat="server" Style="width: 80%"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <th>甲方：
                            </th>
                            <td>
                                <asp:DropDownList ID="DeviceParty" CssClass="ddl" runat="server">
                                </asp:DropDownList>
                            </td>
                            <th>合同份数：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceCopies" CssClass="readOnly" runat="server" Style="display: none"></asp:TextBox>
                                <asp:Label ID="l_DeviceCopies" runat="server">4</asp:Label>
                            </td>
                            <th>存档号：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceFileNO" CssClass="readOnly" runat="server"></asp:TextBox>
                                <asp:Literal ID="l_DeviceFileNO" runat="server"></asp:Literal>
                            </td>
                        </tr>
                        <tr class="qgqy">
                            <th>快递日期：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceExpressDate" CssClass="Wdate ck" onfocus="WdatePicker({maxDate:'%y-%M-%d'})" runat="server"></asp:TextBox>
                            </td>
                            <th>EMS单号：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceEms" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                            <th>递交财务：
                            </th>
                            <td>
                                <asp:RadioButton GroupName="DeviceFinance" CssClass="ck" ID="DeviceFinance1" runat="server" Text="是"
                                    value="True" />
                                <asp:RadioButton GroupName="DeviceFinance" CssClass="ck" ID="DeviceFinance2" runat="server" Checked="true"
                                    Text="否" value="False" />
                            </td>
                        </tr>
                        <tr class="qgqy">
                            <th>合同归档号：
                            </th>
                            <td>
                                <asp:TextBox ID="DeviceArchive" CssClass="readOnly" runat="server"></asp:TextBox>
                            </td>
                            <th>区域收到：
                            </th>
                            <td colspan="3">
                                <asp:CheckBox ID="cb_DeviceRegionReceive" runat="server" CssClass="ck" onclick="" />
                                <label style="margin-right: 10px; color: Red">备注：勾选该项后，请提交收到快递后的确认邮件</label>
                            </td>
                        </tr>
                        <tr>
                            <th>备注：
                            </th>
                            <td colspan="5">
                                <asp:TextBox ID="DeviceRemark" CssClass="readOnly" onblur="changeValue(this)" runat="server" Width="300px"></asp:TextBox>
                            </td>
                        </tr>
                    </tbody>

                </table>
                <input type="hidden"  id="hid_DeviceContractSN"/>
                <input type="hidden"  id="hid_DeviceFixAssetNo" />
                <input type="hidden"  id="hid_DeviceContractType"/>
                 <input type="hidden"  id="hid_DeviceID"/>
                 <input type="hidden"  id="hid_StoreID"/>
                  <input type="hidden"  id="hid_ContractDeviceID"/>
                <!-- 合同信息 ed -->
            </div>
            <!-- 修改页面 ed -->

        </form>
    </div>
</body>
</html>



